
# ifndef __DFX_FILE_READER_H__
# define __DFX_FILE_READER_H__

# include "dfxStream.h"

namespace DFX
{
    class DFX_EXPORT FileReader : public InputStream
    {
    protected:

        FileBase    *mFile;
        UInt64		mPosition;

    public:

        FileReader(FileBase *file)
            : mFile(file), mPosition(0)
        {
        }

        virtual ~FileReader()
        {
        }

        const String& GetFileName() const
        {
            return mFile->GetFileName();
        }

        virtual UInt64 GetSize() const;
        virtual UInt64 GetPosition() const;
        virtual UInt64 GetBytesLeft() const;

        virtual void Seek(UInt64 position);

        virtual bool Eof();
        virtual UInt64 Read(void *buffer, UInt64 size);

        virtual const UInt8* MapStream() const;
        virtual const UInt8* MapStreamFromCurrentPosition() const;

        const String ReadLine();
    };
}

# endif